import java.io.Serializable;

import java.io.*;

/**
 * A single Note represents a note full of String information
 * @author Joshua Zeiser
 *
 */
public class Notes implements Comparable<Notes>, Serializable{

	private String note;

	/**
	 * Constructor takes String value for the note
	 * @param note
	 */
	public Notes(String note) {
		this.note = note;
	}
	
	/**
	 * Empty constructor, sets member note variable to empty string
	 */
	public Notes() {
		this.note = "";
	}
	
	/**
	 * @return String the note
	 */
	public String getNote() {
		return note;
	}

	/**
	 * @param note the note to set
	 */
	public void setNote(String note) {
		this.note = note;
	}
	
	/**
	 * Implements toString() method to return the Notes as a String
	 * @return String
	 */
	@Override
	public String toString()
	{
		return note;
	}

	/**
	 * Overrides default compareTo method, allows comparison of Notes objects
	 * ***Not used for task 3 but implemented for early testing***
	 * @param n
	 * @return int
	 */
	@Override public int compareTo(Notes n) {
		final int BEFORE = -1;
		final int EQUAL = 0;
		final int AFTER = 1;
		
		if(this.equals(n)) return EQUAL;
		
		int comparison = this.note.compareTo(n.getNote());
		if(comparison != 0) return comparison;
		
		return EQUAL;
	}
	
	/**
	 * Overrides default equals method, allows equality comparison of Notes objects
	 * ***Not used for task 3 but implemented for early testing***
	 * @param n
	 * @return boolean
	 */
	@Override public boolean equals(Object n) {
		if(this == n) return true;
		if(!(n instanceof Notes)) return false;
		
		Notes n2 = (Notes)n;
		
		return (this.note.equals(n2.getNote()));
	}
	
}
